Skip to main content

Observer

The Observer design pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Usage     Usage     High

UML class diagram

A visualization of the classes and objects participating in this pattern.

diagram

Sample code

This structural code demonstrates the Observer pattern in which registered objects are notified of and updated with a state change.


Output


See also